/* 
 * File:   Calendar.h
 * Author: Muhammad Anis
 *
 * Created on November 1, 2012, 5:24 PM
 */

#ifndef CALENDAR_H
#define	CALENDAR_H

#include <conio.h>
#include <stdlib.h>
#include <iostream>
#include <queue>
#include <string>
#include <sstream>
#include <algorithm>
#include <iterator>
#include <time.h>

#include "../BaseElementCal/BaseElementCal.h"
#include "../Event/Event.h"
#include "../AbstractFile/AbstractFile.h"
#include "../File/File.h"
#include "../WrongFormatException/WrongFormatException.h"

class Calendar : BaseElementCal, AbstractFile {
public:
    Calendar();
    Calendar(long entryNo, const priority_queue<Event, vector<Event>, Event::EventComparator>&);
    Calendar(const Calendar&);
    Calendar& operator=(const Calendar&);
    ~Calendar();
    /**
     * View an event given the entry number
     * @param calendar the calendar
     * @param args entry number
     */
    void ViewEvent(char** args);
    /**
     * Load a calendar file and read the events
     * @param calendar the calendar read
     * @param args file name
     */
    void LoadCalendar(char** args);
    /**
     * Save event in list to a file
     * @param calendar the calendar
     * @param args file name to save events
     */
    void SaveCalendar(char** args);
    /**
     * Add a new event to the calendar
     * @param calendar the calendar
     * @param args the new event entry number
     */
    void AddEvent(char** args);
    /**
     * Delete an event from list of events in calendar
     * @param calendar the calendar
     * @param args the entry number of deleted event
     */
    void DeleteEvent(char** args);
    /**
     * Prints n first events
     * @param calendar the calendar
     * @param args empty arguments
     */
    void PrintFirst(char** args);
    /**
     * Prints n last events
     * @param calendar the calendar
     * @param args empty arguments
     */
    void PrintLast(char** args);
    /**
     * Show events in a given date
     * @param calendar the calendar
     * @param args date
     */
    void ShowDetail(char** args);
    /**
     * Set list of events
     * @param calendar the calendar
     * @param events the new list of event
     */
    void SetEvents(priority_queue<Event, vector<Event>, Event::EventComparator>);
    /**
     * Returns list of events in the calendar
     * @param calendar the calendar
     * @return list of events
     */
    priority_queue<Event, vector<Event>, Event::EventComparator> GetEvents();
    vector<long> GetEventCountInDay(struct tm* day);
    void SetEntryNo(long newEntryNo);
    long GetEntryNo();
    void PrintInfo(char** argv);
    bool EmptyEvent();
    int MaxDaysInMonth(int month, int year);
    int GetFirstDay(int year, int month);
    
    string toString(){}
    AbstractFile Load(char** argv){}
    void Save(char** argv){}
    BaseElementCal clone(){}
    
    
    void PrintCal(char** argv);
private:
    priority_queue<Event, vector<Event>, Event::EventComparator> events;
    long entryNo;
};
#endif	/* CALENDAR_H */
